package com.lyp.qczp.contoller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lyp.qczp.entity.Mianshi;
import com.lyp.qczp.service.MianshiService;
@CrossOrigin(origins = "*")
@RestController
public class MianshiContoller {
	@Autowired
	private MianshiService mianshiService;
	/**
	 *增改员工
	 * @param employee
	 * @return
	 */
	@PostMapping("/saveMianshi")
	public int save(Mianshi mianshi) {
		
		int save = mianshiService.save(mianshi);
		
		return save;
	}
	/**
	 * 根据eid删除员工
	 * @param eId
	 * @return
	 */
	@PostMapping("/deleteByIdMianshi")
	public int deleteById(Integer msId) {
		return mianshiService.deleteById(msId);
	}
	/**
	 * 分页条件查询员工
	 * @param page
	 * @param rows
	 * @return
	 */
	@PostMapping("/findAllMianshi")
	public Map<String, Object> findAll(Integer page,Integer rows,Mianshi mianshi) {
		PageRequest of = PageRequest.of(page-1, rows);
		Map<String, Object> findAll = mianshiService.findAll(of,mianshi);
		return findAll;
	}
	
	
}
